<?php
include_once("includes/page_utf_class.php");
$sql="select a.*,b.name from ".PROMOLIST." as a inner join ".PROMOCAT." as b on(a.catid=b.id) where a.uid=$buid order by a.id desc";
$page = new Page;
$page->listRows=20;
if (!$page->__get('totalRows')){
	$db->query($sql);
	$page->totalRows = $db->num_rows();
}
$sql .= "  limit ".$page->firstRow.",20";
$pages = $page->prompt();

$db->query($sql);
$re=$db->getRows();
if($_GET['did']){
    $sql="delete from ".PROMOLIST." where id=".$_GET['did']." and uid=$buid";
    $db->query($sql);
    header("Location: ?action=m&m=promo&s=admin_promo_list&menu=info");
}

$tpl->assign("pages",$pages);
$tpl->assign("list",$re);
$output = tplfetch("admin_promo_list.htm");
?>
